home *** CD-ROM | disk | FTP | other *** search
- program AuxTest;
-
- uses Windows, OpenGL, GLAux;
-
- {$R *.RES}
-
- var
- cSelection: Char;
-
- { Callback routine - called when window changes size }
-
- procedure ChangeSize (w, h: GLsizei); stdcall;
- begin
- // Prevent a divide by zero
- if h = 0 then h := 1;
-
- // Set viewport and clipping volume
- glViewport (0, 0, w, h);
- glLoadIdentity;
- if w <= h then glOrtho (-100.0, 100.0, -100.0, 100.0 * h / w, -100.0, 100.0)
- else glOrtho (-100.0, 100 * w / h, -100.0, 100.0, -100.0, 100.00);
- end;
-
- { Callback routine - called by AUX library to render the scene }
-
- procedure RenderScene; stdcall;
- begin
- // Clear the screen
- glClear (GL_Color_Buffer_Bit);
-
- // Rotate one degree around each axis
- // (Note we don't call LoadIdentity() so
- // this rotation is cumulative
- glRotatef (1.0,1.0,0.0,0.0);
- glRotatef (1.0,0.0,1.0,0.0);
- glRotatef (1.0,0.0,0.0,1.0);
-
- // Draw the selected object
- case cSelection of
- 'a': auxWireCone (30.0, 75.0);
- 'b': auxWireCylinder (30.0, 75.0);
- 'c': auxWireDodecahedron (75.0);
- 'd': auxWireIcosahedron (75.0);
- 'e': auxWireOctahedron (75.0);
- 'f': auxWireSphere (75.0);
- 'g': auxWireTeapot (50.0);
- 'h': auxWireTetrahedron (75.0);
- 'i': auxWireTorus (20.0, 50.0);
- 'j': auxWireCube (75.0);
- 'k': auxWireBox (75.0,75.0,75.0);
- end;
-
- glFlush;
- // Swap drawing to screen
- auxSwapBuffers;
- end;
-
- procedure Main;
- begin
- // Display a menu of objects to draw
- Writeln ('Select Wire object to draw:');
- Writeln;
- Writeln ('a - Cone');
- Writeln ('b - Cylinder');
- Writeln ('c - Dodecahedron');
- Writeln ('d - Icosahedron');
- Writeln ('e - Octahedron');
- Writeln ('f - Sphere');
- Writeln ('g - Teapot');
- Writeln ('h - Tetrahedron');
- Writeln ('i - Torus');
- Writeln ('j - Cube');
- Writeln ('k - Box');
-
- // Validate and accept selection
- cSelection := #0;
- while not (cSelection in ['a'..'k']) do begin
- Writeln;
- Write ('Selection: ');
- Readln (cSelection);
- end;
-
- // Setup the AUX library window for double buffer
- auxInitDisplayMode (Aux_Double or Aux_RGBA);
- auxInitPosition (100, 100, 250, 250);
- auxInitWindow ('3D Aux library objects');
-
- // Set background to blue
- glClearColor (0.0, 0.0, 1.0, 1.0);
-
- // Set drawing color to Red
- glColor3f (1.0, 0.0, 0.0);
-
- // Establish window resize function
- auxReshapeFunc (@ChangeSize);
-
- // Establish idle function
- auxIdleFunc (@RenderScene);
-
- // Start main loop
- auxMainLoop (@RenderScene);
- end;
-
- begin
- Main;
- end.
-
-
-
-
-
-